export default {
    //分享
    //参数说明：isAPP是否需要分享  actionType分享面板0关,1打开 shareType分享类型 0网页|1图片|2文本 |3截屏|4视频 shareTitle分享标题 shareSubtitle分享描述 shareVideo分享视频链接地址 showShare APP右上角是否展示 shareCallback0是打开客户端分享面板1是通知H5打开自己的分享面板 newYearGoods 1是年货节 
    shareConfig:function(isApp,actionType,shareType,shareTitle,shareSubtitle,shareUrl,shareImage,shareVideo,showShare,shareCallback,newYearGoods){
        if(isApp=='app'){
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
            var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            const win = window;
            var obj={
                "action": "shareModule",
                "content": {
                    "actionType":actionType,
                    'shareType':shareType,
                    'shareTitle':shareTitle,
                    'shareSubtitle':shareSubtitle,
                    'shareUrl':shareUrl,
                    'shareImage':shareImage,
                    'shareVideo':shareVideo,
                    'showShare':showShare,
                    'shareCallback':shareCallback,
                    'newYearGoods':newYearGoods
                }
            }
            if (isAndroid){
                App.onAppResponse(JSON.stringify(obj));
            }
            if (isIOS) {
                win.webkit.messageHandlers.onAppResponse.postMessage(JSON.stringify(obj));
            }
        }
    },
    //单独分享的模块 platform参数：1 微信 2朋友圈 3 qq 4微博，5,qq空间 其他和上边一样
    singleShare:function(isApp,shareType,shareTitle,shareSubtitle,shareUrl,shareImage,shareVideo,platform){
        if(isApp == 'app'){
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
            var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            const win = window;
            var obj={
                "action": "singleShareModule",
                "content": {
                    'shareType':shareType,
                    'shareTitle':shareTitle,
                    'shareSubtitle':shareSubtitle,
                    'shareUrl':shareUrl,
                    'shareImage':shareImage,
                    'shareVideo':shareVideo,
                    'platform':platform,
                }
            }
            if (isAndroid){
                App.onAppResponse(JSON.stringify(obj));
            }
            if (isIOS) {
                win.webkit.messageHandlers.onAppResponse.postMessage(JSON.stringify(obj));
            }
        }
    },
     //单独调用action
    onAction(isApp,action,content){
        if(isApp == 'app'){
            var u = navigator.userAgent, app = navigator.appVersion;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
            var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
            const win = window;
            var obj={
                "action": action,
                "content":content
            }
            if (isAndroid){
                App.onAppResponse(JSON.stringify(obj));
            }
            if (isIOS) {
                win.webkit.messageHandlers.onAppResponse.postMessage(JSON.stringify(obj));
            }
        }
    }  
}